<link rel="stylesheet" href="http://www.12301.cc/css/common/www.12301.cc.global.css"/>
<link rel="stylesheet" href="http://www.12301.cc/css/page.css"/>
<script language="javascript" src="http://www.12301.cc/js/jquery-1.8.0.min.js"></script>
<!--<script language="javascript" src="http://www.12301.cc/tpl/pft_resource/js/pb.js"></script>-->
<link rel="stylesheet" href="http://www.12301.cc/tpl/pft_resource/css/style.css"/>
<style>
    .whichPageWrap{display: none;}
</style>
<div class="resource_box">
    <div class="inresource_box">
    <div class="box_top setpadding_a">资源库列表</div>
    <form id="search—form" action="">
        <input name="lvl" type="hidden" value="<?=$_GET['lvl']?>"/>
        <input name="type" type="hidden" value="<?=$_GET['type']?>"/>
        <input name="Export" type="hidden" id="Export" value="<?=$_GET['Export']?>"/>
        <input name="verify_status" type="hidden" value="<?=$_GET['verify_status']?>"/>
        <input type="hidden" value="<?=($_GET['d_province']+0).'|'.($_GET['d_city']+0)?>" name="area"/>
        <div class="searchbox setpadding_a">
            <div class="insearchbox">
                <div class="selecebox">
                    <span class="selecetxt">资源名称</span>
                </div>
                <input class="searchinput" type="text" name="title" value="<?=safetxt($_GET['title'])?>"/>
                <a class="searchbtn" id="btn-search" href="javascript:;">搜索</a>
                <input type="button" class="export exportbtn" value="导出" id="excel"/>
               
            </div>
            <div class="termbox">
                <div class="typebox">
                    <span id="area"></span>
                        <?/*
                       <select class="d_province" name="d_province" id="d_province">
                           <option value="">--请选择省--</option>
                           <option value="1000" <?if($_GET['d_province']==1000) echo 'selected';?>>北京市</option>
                           <option value="1100" <?if($_GET['d_province']==1100) echo 'selected';?>>天津市</option>
                           <option value="2900" <?if($_GET['d_province']==2900) echo 'selected';?>>上海市</option>
                           <option value="6530" <?if($_GET['d_province']==6530) echo 'selected';?>>重庆市</option>
                           <option value="5998" <?if($_GET['d_province']==5998) echo 'selected';?>>香港</option>
                           <option value="5999" <?if($_GET['d_province']==5999) echo 'selected';?>>澳门</option>
                           <option value="5997" <?if($_GET['d_province']==5997) echo 'selected';?>>台湾</option>
                           <option value="120" <?if($_GET['d_province']==120) echo 'selected';?>>河北省</option>
                           <option value="130" <?if($_GET['d_province']==130) echo 'selected';?>>山西省</option>
                           <option value="140" <?if($_GET['d_province']==140) echo 'selected';?>>辽宁省</option>
                           <option value="150" <?if($_GET['d_province']==150) echo 'selected';?>>吉林省</option>
                           <option value="160" <?if($_GET['d_province']==160) echo 'selected';?>>江苏省</option>
                           <option value="170" <?if($_GET['d_province']==170) echo 'selected';?>>浙江省</option>
                           <option value="180" <?if($_GET['d_province']==180) echo 'selected';?>>安徽省</option>
                           <option value="190" <?if($_GET['d_province']==190) echo 'selected';?>>福建省</option>
                           <option value="210" <?if($_GET['d_province']==210) echo 'selected';?>>江西省</option>
                           <option value="220" <?if($_GET['d_province']==220) echo 'selected';?>>山东省</option>
                           <option value="230" <?if($_GET['d_province']==230) echo 'selected';?>>河南省</option>
                           <option value="240" <?if($_GET['d_province']==240) echo 'selected';?>>湖北省</option>
                           <option value="250" <?if($_GET['d_province']==250) echo 'selected';?>>湖南省</option>
                           <option value="260" <?if($_GET['d_province']==260) echo 'selected';?>>广东省</option>
                           <option value="270" <?if($_GET['d_province']==270) echo 'selected';?>>海南省</option>
                           <option value="280" <?if($_GET['d_province']==280) echo 'selected';?>>四川省</option>
                           <option value="290" <?if($_GET['d_province']==290) echo 'selected';?>>贵州省</option>
                           <option value="310" <?if($_GET['d_province']==310) echo 'selected';?>>云南省</option>
                           <option value="320" <?if($_GET['d_province']==320) echo 'selected';?>>陕西省</option>
                           <option value="330" <?if($_GET['d_province']==330) echo 'selected';?>>甘肃省</option>
                           <option value="340" <?if($_GET['d_province']==340) echo 'selected';?>>青海省</option>
                           <option value="350" <?if($_GET['d_province']==350) echo 'selected';?>>黑龙江省</option>
                           <option value="360" <?if($_GET['d_province']==360) echo 'selected';?>>西藏</option>
                           <option value="370" <?if($_GET['d_province']==370) echo 'selected';?>>内蒙古</option>
                           <option value="380" <?if($_GET['d_province']==380) echo 'selected';?>>广西省</option>
                           <option value="390" <?if($_GET['d_province']==390) echo 'selected';?>>宁夏</option>
                           <option value="410" <?if($_GET['d_province']==410) echo 'selected';?>>新疆</option>
                       </select>
                       <select class="d_city" name="d_city" id="d_city"></select>
                    */?>
                </div>
                <div class="typebox">
                    <span class="setcolor_d">类型：</span>
                    <ul id="type-list">
                        <li class="<?=!$_GET['type'] || $_GET['type']=='ALL'? 'setbg_a':''?>"  data-ptype="ALL">全部<em class=" num">(<?=$total?>)</em></li>
                        <li class="<?=$_GET['type']=='A'? 'setbg_a':''?>" data-ptype="A">景区<em class="num">(<?=$type_cnt['A']?>)</em></li>
                        <li class="<?=$_GET['type']=='C'? 'setbg_a':''?>" data-ptype="C">酒店<em class="num">(<?=$type_cnt['C']?>)</em></li>
                        <?/*<li class="<?=$_GET['type']=='B'? 'setbg_a':''?>" data-ptype="B">线路<em class="num">(<?=$type_cnt['B']?>)</em></li>*/?>
                    </ul>
                </div>
                <div class="levelbox" style="display: <?=$_GET['type']=='A'?'block':'none'?>">
                    <span class="setcolor_d">等级：</span>
                    <ul class="lvl-list">
                        <li class="<?=(!isset($_GET['lvl']) || $_GET['lvl']=='ALL') ? 'setbg_a':''?>" data-jtype="ALL">全部</li>
                        <li class="<?=$_GET['lvl']=='5'? 'setbg_a':''?>" data-jtype="5">5A</li>
                        <li class="<?=$_GET['lvl']=='4'? 'setbg_a':''?>" data-jtype="4">4A</li>
                        <li class="<?=$_GET['lvl']=='3'? 'setbg_a':''?>" data-jtype="3">3A</li>
                        <li class="<?=$_GET['lvl']==='0'? 'setbg_a':''?>" data-jtype="0">其他</li>
                    </ul>
                </div>
                <div class="levelbox_a" style="display: <?=$_GET['type']=='C'?'block':'none'?>">
                    <span class="setcolor_d">星级：</span>
                    <ul class="lvl-list">
                        <li class="<?=(!isset($_GET['lvl']) || $_GET['lvl']=='ALL')? 'setbg_a':''?>" data-jtype="ALL">全部</li>
                        <li class="<?=$_GET['lvl']==5 ? 'setbg_a':''?>" data-jtype="5">五星</li>
                        <li class="<?=$_GET['lvl']==4 ? 'setbg_a':''?>" data-jtype="4">四星</li>
                        <li class="<?=$_GET['lvl']==3 ? 'setbg_a':''?>" data-jtype="3">三星</li>
                        <li class="<?=$_GET['lvl']==='0' ? 'setbg_a':''?>" data-jtype="0">其他</li>
                    </ul>
                </div>
                <div class="statusbox">
                    <span class="setcolor_d">状态：</span>
                    <ul id="status-list">
                        <li class="<?=$_GET['verify_status']=='ALL'  ? 'setbg_a':''?>" data-status="ALL">全部</li>
                        <li class="<?=$_GET['verify_status']=='0' ? 'setbg_a':''?>" data-status="0">未审核</li>
                        <li class="<?=$_GET['verify_status']==1 ? 'setbg_a':''?>" data-status="1">已审核</li>
                    </ul>
                </div>
                
            </div>
        </div>
        <div class="btnbox">
            <a class="add" href="pft_resource.html?m=add"><i class="iconfont icon_add">&#xe639;</i>&nbsp;新建资源</a>
<!--                    <a class="export" href="javascript:;">-->
<!--                        <img class="icon_xls" src="http://www.12301.cc/web/rebuild/yyl/ordersearchpage/images/excelicon.png"/> 导出</a>-->
         </div>
    </form>
</div>
    <div class="tbbox">
        <table class="tb_addcp" border="0" cellpadding="0" cellspacing="0">
            <thead class="setcolor_d">
            <tr>
                <th id="setalign">资源方名称（终端号）</th>
                <th class="setwidth">类型</th>
                <th class="setwidth">级别</th>
                <th class="setwidth">地区</th>
                <th>资源方</th>
                <th class="setwidth">状态</th>
                <th class="setwidth">添加时间</th>
                <th class="setwidth" >操作</th>
            </tr>
            </thead>
            <tbody>
            <?php
            $zhixia_array = array('1'=>1,'2'=>1,'3'=>1,'4'=>1,'32'=>1,'33'=>1,'34'=>1);
            if(count($data))
            foreach($data as $list):?>
                <?php
                list($prov, $city) = explode('|', $list['area']);
                if($zhixia_array[$prov]) $city=$prov;
                ?>
                <tr id="tr_<?=$list['id']?>">
                    <td class="setheight_a" id="setalign">
                        <em class="setcolor_a "><?=$list['title']?></em>（<?=$list['terminal']!=0? $list['terminal'] : '尚无终端'?>）
                    </td>
                    <td><?=$ptypes[$list['p_type']]?></td>
                    <td><?=$LevelList[$list['p_type']][$list['jtype']]?></td>
                    <td><?=$areas[$prov] .'-'.$areas[$city]?></td>
                    <td><?=$list['apply_did']?></td>
                    <td class="setcolor_e" style="color: <?=$status_color[$list['verify_status']]?>"><?=$status_list[$list['verify_status']]?></td>
                    <td class="set_lineheight"><?=$list['addtime']?></td>
                    <td class="set_acolor">
                        <a class="setcolor_a" href="pft_resource.html?m=edit&resource_id=<?=$list['id']?>"><i class="iconfont setfont">&#xe684;</i> </a>
                        <a class="setcolor_b rm" href="javascript:;" data-id="<?=$list['id']?>"><i class="iconfont setfont">&#xe634;</i> </a>
                    </td>
                </tr>
            <?php endforeach;
            else echo <<<HTML
                <tr>
                <td colspan="8" style="height: 40px; line-height: 40px; font-size: 14px;">暂无数据</td>
                </tr>
HTML;
            ?>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="8"><?page($total_items, $currentPage, $pageSize);?></td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
<script type="text/javascript" src="http://www.12301.cc/js/global/www.12301.cc.global.js"></script>
<script type="text/javascript" src="http://www.12301.cc/js/getaress.js"></script>
<?/*<script type="text/javascript" src="http://www.12301.cc/web/rebuild/yyl/sheng/js/getaress_zax.js"></script>*/?>
<script>
    $(document).ready(function(){

        <?/*
        //页面刚加载完后 如果之前有选择了市 那么自动选上之前的市
        var d_city_val=<?=$_GET['d_city']+0>0?$_GET['d_city']:'""'?>;
        $("#d_city option").each(function(){
            if($(this).val()==d_city_val)
                $(this).attr('selected','selected');
        });
        */?>
        if($("#area").length){
            var area,pro_id, city_id,countr_id;
            if($("input[name='area']").val()){
                area = $("input[name='area']").val().split('|'),
                    por_id = area[0],city_id = area[1],country_id = area[2];
            }

            else {
                por_id = '',city_id = '',country_id = '';
            }
            $("#area").getAreas({update:true,pro_id:por_id,
                city_id:city_id,county_id:country_id,depth:2});
        }

        var _form = {
            do_search : function(){
                $("#search—form").submit();
            },
            rm: function(){

            }
        };
//        var do_search = function(){
//
//        };
        $("tbody").on('click', 'a.rm', function(){
            if (!confirm('确定要删除吗？')) {
                return false;
            }
            var id = $(this).data('id');
            $.post('/module/pft_resource/api.php', {action:'DELETE_RESOURCE', id:id}, function(ret){
                if (ret==1) {
                    PFT_GLOBAL.U.Alert("success",'<p style="width:400px">删除成功</p>');
                    $("#tr_"+id).hide();
                } else {
                    PFT_GLOBAL.U.Alert("fail",'<p style="width:400px">删除失败,请检查是否有关联产品</p>');
                }
            });
        });
        $("#type-list").on('click', 'li', function(){
            var type = $(this).data('ptype');
            $("input[name=type]").val(type);
            _form.do_search();
        });
        $(".lvl-list").on('click', 'li', function(){
            var type = $(this).data('jtype');
            $("input[name=lvl]").val(type);
            _form.do_search();
        });

        $("#status-list").on('click', 'li', function(){
            var type = $(this).data('status');
            $("input[name=verify_status]").val(type);
            _form.do_search();
        });
        $("#btn-search").on('click', function(){
            _form.do_search();
        });
        $(".d_province").css("width","226px");

        $("#excel").click(function(){
            $("#Export").val("Export");
            _form.do_search();
            $("#Export").val("");
        })

});
</script>